package org.hcyspartnoc.demo.dao;

import org.hcyspartnoc.demo.entity.Major;
import org.hcyspartnoc.demo.entity.Scheme;
import org.hcyspartnoc.demo.entity.Target;
import org.hcyspartnoc.demo.pojo.vo.traProgram.SchemeVO;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface SchemeDao extends Neo4jRepository<Scheme,Long> {


    @Query("""
        MATCH (s:scheme)-[:包含]->(target:target)
        MATCH (s:scheme)-[:包含]->(require:require)
        MATCH (s:scheme)-[:包含]->(expand:expand)
        WHERE s.version = $version
        RETURN s,target,require,expand
    """)
    Scheme findSchemeWithTargetsAndRequires(@Param("version") String version);


    @NotNull List<Scheme> findAll();

}
